// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from "vue";
import ElementUI from "element-ui";
import "element-ui/lib/theme-chalk/index.css";
import axios from "axios";
import App from "./App";
import router from "./router";
import md5 from "js-md5";
import store from "./store";
import JsEncrypt from "jsencrypt";

Vue.config.productionTip = false;

/* 饿了么样式组件 */
Vue.use(ElementUI);
/* 引入全局样式文件 */
import "./assets/css/style.css";

//Vue.use(axios);
/* MD5加密 */
Vue.prototype.$md5 = md5;
Vue.prototype.$axios = axios;

/* RSA2加密 */
/**
 * 配置全局的加密方法
 * @param obj 需要加密的字符串
 */
Vue.prototype.$encruption = function(obj) {
  let encrypt = new JsEncrypt();
  // 公钥
  encrypt.setPublicKey(
    "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqO8mfl+NLDo4bnDsahuRefzy9dtp7+IUHpLBe7PmqQIAKeGphNHtJHYQ6PQOcn0qRUb2uy664Ba0eCe4gqEmY1/Tp/c1eK/UKNXvduTBxjDjLqTLnvuuJSBGkFLajoRibbH3Kxqk/2r03ARr7XbMHmO5L6wo6kX0KEwsXAlrm5dwbG3XF5C6trgEdhCxc5BO/rq/TWzWssp7zDtPe5dhIM9G2VCn5L6p4wi3mFbelCDcdl+C24mLWVCW/r92MQPAl65fK/f4rM9PHwLdMQPPq41c1Whl0frC8sjoAUb18xAp08bswA5CgxWyEHYTNye9x1quyeJv2y/vH2R7cUuBOwIDAQAB"
  );
  return encrypt.encrypt(obj);
};

/* eslint-disable no-new */
new Vue({
  el: "#app",
  router,
  store,
  components: { App },
  template: "<App/>"
});
